import type { Stock } from "$lib/types/stock";
export const sampleStocks: Stock[] = [];

// Generate 1000 sample stock objects
// Generate 1000 sample stock objects
for (let i = 1; i <= 200; i++) {
    const stock: Stock = {
        id: i,
        code: "SH.KZZ."+String(i).padStart(6, '0'), // Generate a 6-digit stock code
        name: `Sample Stock ${i}`,
        relatedLink: `https://example.com/stock/${String(i).padStart(6, '0')}`,
        latestPrice: parseFloat((Math.random() * 100).toFixed(2)), // Randomly generate latest price between 0.00 and 100.00
        changePercent: Math.random().toFixed(2) + '%', // Randomly generate change percentage between 0.00% and 100.00%
        changeAmount: parseFloat((Math.random() * 10).toFixed(2)), // Randomly generate change amount between 0.00 and 10.00
        volume: Math.floor(Math.random() * 100000), // Randomly generate volume between 0 and 100,000 (no decimal places required)
        turnover: Math.floor(Math.random() * 100000000), // Randomly generate turnover between 0 and 100,000,000 (no decimal places required)
        amplitude: (Math.random() * 100).toFixed(2) + '%', // Randomly generate amplitude between 0.00% and 100.00%
        high: parseFloat((Math.random() * 100).toFixed(2)), // Randomly generate highest price between 0.00 and 100.00
        low: parseFloat((Math.random() * 100).toFixed(2)), // Randomly generate lowest price between 0.00 and 100.00
        openToday: parseFloat((Math.random() * 100).toFixed(2)), // Randomly generate opening price today between 0.00 and 100.00
        lastClose: parseFloat((Math.random() * 100).toFixed(2)), // Randomly generate last closing price between 0.00 and 100.00
        volumeRatio: ((Math.random() * 10) * 100).toFixed(2), // Randomly generate volume ratio between 0.00 and 10.00
        turnoverRate: parseFloat(Math.random().toFixed(2)), // Randomly generate turnover rate between 0.00% and 100.00%
        peRatio: (Math.random() * 100).toFixed(2), // Randomly generate PE ratio between 0.00 and 1000.00
        pbRatio: (Math.random() * 100).toFixed(2), // Randomly generate PB ratio between 0.00 and 10.00
        quantGrade: parseFloat(((Math.random() * 10) * 100).toFixed(0)),
        addToFavorites: `https://quote.eastmoney.com/unify/r/${String(i).padStart(6, '0')}`,
    };

    sampleStocks.push(stock);
}
